package action.concreteActions;

import grammer.Predicate;
import grammer.components.PredicateEnum;
import person.PersonAchive;
import timer.Timer;
import action.ExecuteActionInterface;

/**
 * 
 * 
 * @author Minodor Used for predicates Leaves, Comes
 */
public class ContextAction extends ExecuteActionInterface {
	private boolean inHouse;

	public ContextAction(Timer executeTime, Predicate p) {
		super(executeTime);
		if (p.getPredicate().equals(PredicateEnum.LEAVES))
			inHouse = false;
		else
			inHouse = true;
		// TODO Auto-generated constructor stub
	}

	@Override
	public int execute() {
		if (PersonAchive.getPerson(this.getOnwer()) != null)
			PersonAchive.getPerson(this.getOnwer()).setInHouse(inHouse);
		return 0;
	}

	@Override
	public int getEndTimer() {

		return executeTime.getTime();
	}

	@Override
	public int getExecuteTimer() {
		return executeTime.getTime();
	}

	@Override
	public int getStartTimer() {

		return executeTime.getTime();
	}

}
